import http.server

server_address = ("", 8000)
httpd = http.server.HTTPServer(server_address, http.server.SimpleHTTPRequestHandler)
httpd.serve_forever()

# 上面代码同直接运行命令: python3 -m http.server 8000

# 本地浏览器访问: http://localhost:8000
